package com.example.demo;

//import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;

import org.junit.Test;
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;


@RestController
@RequestMapping("/test")
public class TestController {
    //    @Autowired
//    #private ElasticsearchTemplate elasticsearchTemplate;
    @Autowired
    private ItemRepository itemRepository;

    //http://localhost:8088/demo/test/hello
    @GetMapping("/hello")
    public String hello() {
        System.out.println("hello :" + new Date());

        return (new Date()).toString();
    }


    //http://localhost:8088/demo/test/queryOne
    @GetMapping("/save")
    public String testSave() {
        System.out.println("testSave----> :" + new Date());
        Item item = new Item(1L, "小米9", " 手机", "小米", 2999.00, "http://image.baidu.com/13123.jpg");
        itemRepository.save(item);
        return ("testSave---->end---> :" + new Date());
    }


}
